<?php
namespace ZHMVC\DB\MANAGER;

if (! isset($_SESSION)) {
    session_start();
}
include (dirname(dirname(__FILE__)) . "/zhconfig/Config.php");
include (ZH_PATH . DS . MANAGERFPATH . DS . 'islogin' . ZH);

$isp = new \ZHMVC\D\MANAGER\isPermission();
$isper = $isp->getPermission();
$_curlid = $isp->getCUrl();
$c = new \ZHCONFIG\ZhConfig();
$db_pre = $c->getDbPre();

if($isper==1)
{
    $ErrMsg="对不起，你没有访问该页面的权限";
    echo $ErrMsg;
    exit;
}
elseif($isper==0)
{
    $ErrMsg="对不起，地址错误";
    echo $ErrMsg;
    exit;
}

include (ZH_PATH . DS . MANAGERFPATH . DS . 'top1' . ZH);
?>
<div class="wap-container">
	<nav class="breadcrumb" style="background-color:#fff;padding: 0 24px">
	登录日志
	<a class="btn btn-success radius f-r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
	</nav>
<?php 

$action = SafeRequest(getPGC('atcion'), 0);
switch ($action) {
    default:
        main($db_pre);
}

function main($db_pre)
{
    ?>
<article class="Hui-admin-content clearfix">
<div class="panel mt-20">
	<div class="panel-body">
		<div class="clearfix mt-20">
						<table class="table table-striped table-bordered">
							<thead>
								<tr>
									<th>ID</th>
									<th>用户</th>
									<th>登录时间</th>
									<th>结果</th>
								</tr>
							</thead>
							<tbody>
  <?php
    // $sql="select id,name,info from ".$db_pre."plus_attribute order by id desc";
    
    $rs = D("" . $db_pre . "loginlog")->getLinkAll("id,username,addtime,result", true);
    $datas = $rs['datas'];
    $rows = $rs['rows'];
    for ($j = 0; $j < $rows; $j ++) {
        $data = $datas[$j];
        ?>
 <tr>
									<td><?php echo $data['id'];?></td>
									<td><?php echo $data['username'];?></td>
									<td><?php echo $data['addtime'];?></td>
									<td><?php echo $data['result'];?></td>
									
								</tr>
        <?php
    }
    ?>
              </tbody>
						</table>
					</div>
				</div>
		</div>
		</article>
<?php
}
?>
</div>
<?php 
include (ZH_PATH . DS . MANAGERFPATH . DS . 'foot1' . ZH);
?>
	<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>